#pragma once
#include <vulkan/vulkan.h>
#include <vector>
#include <algorithm>
class VKSwapChain
{
public:

	void CreateSwapChainAndSwapChainViews(VkSurfaceKHR surface);
	void CreateDepthImageAndDepthImageView();
	void CreateFrameBuffers(VkRenderPass renderPass);
	void DestroySwapChainFramebufferAndDepthImage();


	VkSwapchainKHR m_SwapChain;
	VkFormat m_SwapChainImageFormat;
	VkExtent2D m_SwapChainImageExtent;
	std::vector<VkImage> m_SwapChainImages;
	std::vector<VkImageView> m_SwapChainImageViews;

	VkImage m_DepthImage;
	VkImageView m_DepthImageView;
	VkDeviceMemory m_DepthImageMemory;
	VkFormat m_DepthFormat;

	std::vector<VkFramebuffer> m_SwapChainFrameBuffers;


private:
	VkSurfaceFormatKHR ChooseSwapChainsSurfaceFormat(std::vector<VkSurfaceFormatKHR> availableFormats);
	VkPresentModeKHR ChooseSwapChainPresentMode(std::vector<VkPresentModeKHR> availablePresentModes);
	VkExtent2D ChooseSwapChainExtent(const VkSurfaceCapabilitiesKHR& capabilities);
	void CreateSwapChain(VkSurfaceKHR surface);
	void CreateSwapChainImageViews();

	void CreateDepthImage();
	void CreateDepthImageView();

};

